package org.cogaen.java2d;

import java.awt.Font;

import org.cogaen.core.Core;
import org.cogaen.resource.ResourceHandle;

public class FontHandle extends ResourceHandle {

	private String fontName;
	private int fontSize;
	private int fontStyle;
	private Font font;
	
	public FontHandle(String resName, String fontName, int style, int size) {
		super(resName);
		this.fontName = fontName;
		this.fontStyle = style;
		this.fontSize = size;
	}

	@Override
	public boolean isLoaded() {
		return this.font != null;
	}

	@Override
	public void load(Core core) {
		this.font = new Font(this.fontName, fontStyle, fontSize);
	}

	@Override
	public void unload() {
		this.font = null;
	}

	@Override
	public Object getResource() {
		return this.font;
	}

}
